package org.wattdepot.cli.commands;

import java.util.ArrayList;
import java.util.List;
import org.wattdepot.resource.source.jaxb.Source;
import org.junit.Test;
import org.wattdepot.cli.CommandLineInterface;
import org.wattdepot.client.WattDepotClient;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;;;
/**
 * Test case for the SummaryListCommand.
 * @author Paul Galiza
 *
 */
public class TestSummaryListCommand {

  
  /**
   * Test to see if the source checker works.
   * @throws Exception NotAuthorizedException, ResourceNotFoundException, 
   *                   BadXmlException, MiscClientException.
   */
  @Test
  public void testSummaryListCommand() throws Exception {
    CommandLineInterface cli = new CommandLineInterface();
    WattDepotClient client = cli.getClient();
    SummaryListCommand summarylist = new SummaryListCommand();
    List<String> userInput = new ArrayList<String>();
    userInput.add("");
    userInput.add("Test_Source");
    String actual = summarylist.doCommand(userInput, client);
    assertEquals("Testing source validity!", "Invalid Source", actual);
    userInput.add(1, "SIM_KAHE");
    
    Source source = client.getSource(userInput.get(1));
    assertNotNull("Testing SIM_KAHE has subsources", source.getSubSources());
  }
}
